import { createHash } from "../../func/chatList/chat";

const addChat = function (chatKey) {
  return {
    type: "ADD_CHAT",
    chatKey,
    chatKeyHash: createHash(chatKey),
  };
};

const writeMessage = function (chatHash, userName, timestamp, image, message) {
  return {
    type: "NEW_MESSAGE",
    chatHash,
    userName,
    timestamp,
    image,
    message,
  };
};

const onlineList = function (chatID, list) {
  return {
    type: "ONLINE_LIST",
    chatID,
    list,
  };
};

export { addChat, writeMessage, onlineList };
